<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"
    import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=request.getParameter("id")%>設備詳細資料</title>
</head>
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="p_state" scope="page" class="bean.StateBean"/>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/>
<jsp:useBean id="pclass" scope="page" class="myclass.P_Class"/>
<% 
	  String sql="select * from FACILITY WHERE F_ID='"+request.getParameter("id")+"'";
	  ResultSet rs=mydb.executeQuery(sql);
	  rs.next();
	  sql="select * from FACILITY_CLASS WHERE FC_ID='"+rs.getString("F_Class")+"'";
      ResultSet rs2=pclass.getPcName(sql);
      rs2.next();
%>
	  
    <table width="500" border="1" bordercolor="#999999" align="center">
          <tr>
            <td width="91" align="left" bgcolor="#9999CC" scope="row"><span class="style46">設備編號</span></td>
            <td width="274"><%=rs.getString("F_ID")%></td>
            <td width="91" align="left" bgcolor="#9999CC" scope="row"><span class="style46">設備類別</span></td>
            <td width="274"><%=rs2.getString("FC_NAME")%></td>
            <td width="91" align="left" bgcolor="#9999CC" scope="row"><span class="style46">名稱</span></td>
            <td width="274"><%=rs.getString("F_NAME")%></td>
            <td width="91" align="left" bgcolor="#9999CC" scope="row"><span class="style46">狀態</span></td>
            <td width="274"><%=p_state.getPState(rs.getString("F_STATE"))%></td>
          </tr>
          <tr>
            <td width="91" align="left" bgcolor="#9999CC" scope="row"><span class="style46">規格</span></td>
            <td colspan="7"><%=rs.getString("F_DETAIL")%></td>
          </tr>
          <tr>
            <td width="91" align="left" bgcolor="#9999CC" scope="row"><span class="style46">備註</span></td>
            <td colspan="7"><%=rs.getString("PS")%></td>
          </tr>
          
	  </table>
   <%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>
 
</body>
</html>